﻿using System.ComponentModel.Composition;
using System.Threading.Tasks;

namespace NoMvvm.Demo.Models
{
    /// <summary>
    /// Class exposing operations to the Hubble space telescope
    /// </summary>
    [Export(typeof(Telescope))]
    public sealed class Telescope
    {
        /// <summary>
        /// Asynchronously sends message to the hubble space telescope for the current diameter of the planets.
        /// </summary>
        public async Task<Planet[]> MeasurePlanets()
        {
            await TaskEx.Delay(3000);

            return await TaskEx.FromResult(new Planet[]
            {
                new Planet { Name = "Mercury", Diameter = 4880 },
                new Planet { Name = "Venus", Diameter = 12104 },
                new Planet { Name = "Earth", Diameter = 12756 },
                new Planet { Name = "Mars", Diameter = 6794 },
                new Planet { Name = "Jupiter", Diameter = 142984 },
                new Planet { Name = "Saturn", Diameter = 120536 },
                new Planet { Name = "Uranus", Diameter = 51118 },
                new Planet { Name = "Neptune", Diameter = 49532 },

                //Wait! this isn't a planet
                //new Planet { Name = "Pluto", Diameter = 2274 },
            });
        }
    }
}
